package com.wzcl.app.model.vo;


import com.wzcl.app.dao.model.Course;
import com.wzcl.app.dao.model.UserCourse;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

@EqualsAndHashCode(callSuper = false)
@Data
public class UserCourseVo extends BaseVo{
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户id")
    private Integer userId;

    @ApiModelProperty(value = "用户手机号")
    private String userPhone;

    @ApiModelProperty(value = "课程")
    private CourseVo course;


    private UserCourseVo() {
    }

    public static UserCourseVo create(UserCourse userCourse){
        UserCourseVo userCourseVo = new UserCourseVo();
        BeanUtils.copyProperties(userCourse,userCourseVo,"course");
        Course course = userCourse.getCourse();
        if(course !=null){
            course.setCommodity(null);//忽略商品信息
            userCourseVo.course = CourseVo.create(course);
        }
        userCourseVo.translationValueStr();
        return userCourseVo;
    }

    @Override
    public void translationValueStr() {

    }

    @Override
    public void processResources() {

    }
}
